import request from '@/config/axios'

// ERP 采购发票审核单 VO
export interface InvoiceCheckListVO {
  id: number // id
  checkInvoiceId: string // 发票审核单编号
  supplierId: number // 供应商编号
  totalPrice: number // 订单总金额，单位：元
  remark: string // 备注
  invoiceStatus: string // 发票审核状态
  payStatus: string // 打款审核状态
  processInstanceId: string // 流程实例的编号
}

// ERP 采购发票审核单 API
export const InvoiceCheckListApi = {
  // 查询ERP 采购发票审核单分页
  getInvoiceCheckListPage: async (params: any) => {
    return await request.get({ url: `/erp/invoice-check-list/page`, params })
  },

  // 查询ERP 采购发票审核单详情
  getInvoiceCheckList: async (id: number) => {
    return await request.get({ url: `/erp/invoice-check-list/get?id=` + id })
  },

  // 新增ERP 采购发票审核单
  createInvoiceCheckList: async (data: InvoiceCheckListVO) => {
    return await request.post({ url: `/erp/invoice-check-list/create`, data })
  },

  // 修改ERP 采购发票审核单
  updateInvoiceCheckList: async (data: InvoiceCheckListVO) => {
    return await request.put({ url: `/erp/invoice-check-list/update`, data })
  },

  // 删除ERP 采购发票审核单
  deleteInvoiceCheckList: async (id: number) => {
    return await request.delete({ url: `/erp/invoice-check-list/delete?id=` + id })
  },

  // 导出ERP 采购发票审核单 Excel
  exportInvoiceCheckList: async (params) => {
    return await request.download({ url: `/erp/invoice-check-list/export-excel`, params })
  },
  // 根据发票审核单编号 修改发票审核单状态
  updateInvoiceCheckListStatusByCheckInvoiceId: async (checkInvoiceId: string, invoiceStatus: string) => {
    return await request.put({ url: `/erp/invoice-check-list/update-status-by-check-invoice-id?checkInvoiceId=${checkInvoiceId}&invoiceStatus=${invoiceStatus}` })
  },
  // 根据发票审核单编号 修改打款审核状态
  updateInvoiceCheckListPayStatusByCheckInvoiceId: async (checkInvoiceId: string, PayStatus: string) => {
    return await request.put({ url: `/erp/invoice-check-list/update-pay-status-by-check-invoice-id?checkInvoiceId=${checkInvoiceId}&payStatus=${PayStatus}` })
  },
}
